<template>
  <div id="home" style="background-color: white">
    <div
      style="
        float: left;
        background-color: white;
        width: 50px;
        max-height: 450px;
        min-height: 420px;
      "
    ></div>
    <div
      class="profile"
      align="left"
      style="
        float: left;
        background-color: white;
        width: 300px;
        max-height: 450px;
        min-height: 420px;
        line-height: 28px;
      "
    >
      <div>
        学号：<font
          style="
            font-size: 20px;
            line-height: 30px;
            color: #6699cc;
            font-weight: bolder;
          "
          >{{ user.username }}</font
        >
      </div>

      <div>昵称：{{ user.nickname }}</div>
      <div>姓名：{{ user.name }}</div>
      <div>性别：{{ user.sex == 0 ? "男" : "女" }}</div>
      <div>邮箱：{{ user.email }}</div>
      <div>手机号：{{ user.phone }}</div>
      <div>入学年份：{{ user.enterYear }}</div>
      <div>班级：{{ user.className }}</div>
      <div>专业：{{ user.subject }}</div>
      <div>发帖数量：{{ user.topicCount }}</div>
      <div>评论数量：{{ user.commentCount }}</div>
    </div>

    <div
      align="left"
      style="
        float: left;
        background-color: white;
        width: 360px;
        min-height: 420px;
        max-height: 450px;
      "
    >
      <div class="demo-fit">
        <div class="block">
          <el-avatar
            shape="circle"
            :size="148"
            :fit="fit"
            :src="imageUrl"
          ></el-avatar>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  data() {
    return {
      fit: "fill",
      user: JSON.parse(sessionStorage.getItem("user")),
      imageUrl:
        "http://localhost:8080/forum/upload/" +
        JSON.parse(sessionStorage.getItem("user")).avatar,
    };
  },
  methods: {
    iFrameHeight(n) {
      var ifm = document.getElementById("test" + n);
      var subWeb = document.frames
        ? document.frames["test" + n].document
        : ifm.contentDocument;
      if (ifm != null && subWeb != null) {
        ifm.height = subWeb.body.scrollHeight;
      }
    },
    test_item(n) {
      var menu = document.getElementById("leftBodyNav");
      var menuli = menu.getElementsByTagName("div");
      for (var i = 1; i <= menuli.length; i++) {
        menuli[n - 1].className = "leftBodyNavDown";
        menuli[i - 1].className = "leftBodyNavStyle";
        document.getElementById("home").style.display = "none"; //隐藏
        document.getElementById("content").style.display = "block"; //隐藏
      }
    },
    checkULogin() {
      var msg = "${sessionScope.user.username}";
      if (!msg) {
        var returnVal = window.confirm("未登录或登录已失效！请登录！", "提示");
        if (returnVal) {
          location.href = "login.jsp";
        }
        return false;
      }
      return true;
    },
  },
  mounted() {},
};
</script>

<style scoped>
.profile div {
  margin-top: 10px;
}
.profile :first-child {
  margin-top: 15px;
}
.block {
  margin-left: 100px;
  margin-top: 20px;
}
</style>
